<script>
export default {
  name: "gf-other-goods",
  props: {
    goodsList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      isShopMore:  false,//是否显示更多商品
    };
  },
  mounted() {

  },
  methods: {

    // 跳转商品详情
    goGoodsDetail(item) {
      uni.navigateTo({
        url: `/pages/goods/goods?id=${item.id}`
      });
    }
  }
}
</script>

<template>
  <view class="gf_goods_content">
    <view class="head">
      <text class="title">商品信息</text>
      <view class="change" @click="isShopMore = true">
        <text>查看更多</text>
        <u-icon name="arrow-right" color="#888888"></u-icon>
      </view>
    </view>
    <view class="goods_content">
      <view class="goods" v-for="(goodsItem,index) in goodsList" :key="index" >
        <image :src="goodsItem.picUrl"></image>
        <view class="name"> {{ goodsItem.name }}</view>
        <view>
          <text class="price">￥{{ goodsItem.actPrice }}</text>
          <text class="line_price">￥{{ goodsItem.oriPrice }}</text>
        </view>
      </view>
    </view>
    <!--更多商品-->
    <u-popup  v-model="isShopMore" mode="bottom"  border-radius="20" height="50%" closeable="true">
      <view class="pop-box">
        <view>
          <view class="box-title">商品列表</view>
          <u-line color="#eeeeee"></u-line>
        </view>
        <view class="bgTitle-box">
          <scroll-view scroll-y="true" style="height: 100%;">
            <view class="goods_content1">
              <view class="goodsList" v-for="(goodsItem,index) in goodsList" :key="index">
                <view class="goodsImg">
                  <image class="goodsImg" :src="goodsItem.picUrl"></image>
                </view>
                <view style="margin-left: 10rpx">
                  <view class="name"> {{ goodsItem.name }}</view>
                  <view class="sell"> 月销量：{{ goodsItem.monthSaleNum }}</view>
                  <view>
                    <text class="price">￥{{ goodsItem.actPrice }}</text>
                    <text class="line_price">￥{{ goodsItem.oriPrice }}</text>
                  </view>
                </view>
              </view>
            </view>
          </scroll-view>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<style scoped lang="scss">
.gf_goods_content {
  background-color: #FFFFFF;
  margin-bottom: 30rpx;
  border-radius: 20rpx;
  padding: 20rpx;
  .head {
    display: flex;
    height: 50rpx;
    line-height: 50rpx;
    font-size: 30rpx;

    .change {
      display: flex;
      font-size: 26rpx;
      color: #888888;
      align-items: center;

      image {
        margin-right: 6rpx;
        width: 32rpx;
        height: 32rpx;
      }
    }

    .title {
      flex: 1;
    }
  }
}

.goods_content {
  margin-top: 20rpx;
  display: flex;
  overflow-x: auto;
  .goods {
    width: 210rpx;
    padding: 0 6rpx;
    margin-right: 13rpx;
    background-color: #FAFAFA;
    border-radius: 10rpx;
  }

  image {
    width: 200rpx;
    height: 200rpx;
    border: #333333 1rpx dot-dash;
    border-radius: 8rpx;
  }

  .name {
    color: #171717;
    font-size: 24rpx;
    margin: 10rpx 0 6rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }

  .price {
    color: #FE5414;
    font-size: 28rpx;
  }

  .line_price {
    margin-left: 10rpx;
    color: #B8B8B8;
    font-size: 26rpx;
    text-decoration: line-through;
  }
}


/* 商品弹窗 */
.pop-box {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  .box-title {
    height: 80rpx;
    font-weight: bold;
    font-size: 18px;
    margin: auto 0;
    padding: 20rpx 30rpx;
    border-radius: 20rpx 20rpx 0 0;
    background: #fff;
  }
  .bgTitle-box {
    flex: 1;
    overflow-y: auto;
    .goods_content1 {
      padding: 20rpx 0 calc(env(safe-area-inset-bottom));
      .goods {
        width: 200rpx;
      }

      image {
        border: #333333 1rpx dot-dash;
        border-radius: 8rpx;
      }

      .name {
        color: #171717;
        font-weight: bold;
        font-size: 28rpx;
        margin: 10rpx 0 6rpx;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
      }
      .sell{
        color: #999999;
        font-size: 24rpx;
        margin: 10rpx 0 10rpx;
      }
      .price {
        color: #FE5414;
        font-size: 28rpx;
        font-weight: bold;
      }

      .line_price {
        margin-left: 10rpx;
        color: #B8B8B8;
        font-size: 26rpx;
        text-decoration: line-through;
      }

      .goodsList {
        display: flex;
        margin-bottom: 26rpx;
        margin-right: 20rpx;
        margin-left: 20rpx;
        height: 168rpx;

        .goodsImg{
          background-color: #999999;
          width: 168rpx;
          height: 168rpx;
          border: #333333 1rpx dot-dash;
          border-radius: 8rpx;
        }
      }
    }
  }
}

</style>